<?php
// include function files for this application
require_once('/home/domains/uny-con.com/public_html/uny-con_fns.php');
if (!session_id()) { session_start(); }


do_html_header('UNY-Con Convention Discount', gobig, $uny);

if (!check_valid_user() || $_SESSION['admin'] != 't') {
	echo 'You are not logged in or are not an administrator, please login with the registration tab above';
	print_brs(24);
	do_html_footer();
	exit;
	}

	extract($_POST);
	if(isset($prefix)) { $prefix = strtoupper($prefix); }
	If((isset($expire_date))&&(!isset($gen_discount))) { $expire_date = "$expire_date 00:00:00-05"; }
	if($unlimited == "t") {$num_of_uses = "-1"; }
	$values = array(description => $description, prefix => $prefix, discount_amount => $discount_amount, kickback_amount => $kickback_amount, expire_date => $expire_date, num_of_uses => $num_of_uses, unlimited => $unlimited, coupon_code => $coupon_code);

function random_alphanum($length=1)
{
	$retVal = "";
	while(strlen($retVal) < $length){
	$nextChar = mt_rand(0, 61); // 10 digits + 26 uppercase + 26 lowercase = 62 chars
	if(($nextChar >=10) && ($nextChar < 36)){ // uppercase letters
		$nextChar -= 10; // bases the number at 0 instead of 10
		$nextChar = chr($nextChar + 65); // ord('A') == 65
	} else if($nextChar >= 36){ // lowercase letters
		$nextChar -= 36; // bases the number at 0 instead of 36
		 $nextChar = chr($nextChar + 97); // ord('a') == 97
	} else { // 0-9
		$nextChar = chr($nextChar + 48); // ord('0') == 48
	}
	$retVal .= $nextChar;
	}
 return $retVal;

}


print_discount_form($formsent, $values, $gen_discount);
do_html_footer(no_news);
?>